package com.lsk.product.Controller;


import com.lsk.model.Bean.Product;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
public class ProductController {

    @GetMapping("/get")
    public Product getProduct(@RequestParam("productId") Long productId, HttpServletRequest request) {
        System.out.println("被调用----->  @GetMapping(\"/product/get\")");
        String tocken = request.getHeader("x-token");
        System.out.println("x-token:" + tocken);
//        try {
//            System.out.println("被调用尝试中----->  @GetMapping(\"/product/get\")");
//            Thread.sleep(60000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
        Product product = new Product();
        product.setProductId(productId);
        product.setProductName("商品"+productId);
        product.setProductPrice(100.0);
        return product;
    }
}
